package com.fang.stream_export_date.controller;

import com.fang.stream_export_date.server.impl.DownloadServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Description
 * @Author Bernie
 * @Date 2023/4/6 15:49
 **/
@RestController
public class TestController {

    @Autowired
    private DownloadServiceImpl downloadService;

    @GetMapping("/abcd")
    public String test(String name) {
        return "abac";
    }

    @GetMapping("/streamDownload")
    public void streamDownload(HttpServletResponse response) throws IOException {
        downloadService.streamDownload(response);
    }

    @GetMapping("/testError")
    public String testError() throws IOException, InterruptedException {
        Thread.sleep(10 * 1000);
        System.out.println("请求");
        return "success";
    }


}
